#include "Animation.h"

Animation::Animation(thor::FrameAnimation::Ptr ani, float duration, float x, float y) : done(false), duration(duration)
{
    sprite.SetPosition(x, y);
    sprite.SetTexture(rm->getTexture("explosion6.png"));
    sprite.Scale(1.2, 1.2);
    animator.AddAnimation("ani", ani, sf::Milliseconds(duration));
    animator.PlayAnimation("ani");
    //clock.Restart();
}

void Animation::play()
{

}

void Animation::update(sf::RenderWindow* Window)
{
    animator.Update(sf::Milliseconds(10));
    animator.Animate(sprite);
    Window->Draw(sprite);
    if(clock.GetElapsedTime().AsSeconds() > 3)
        done = true;
}
